﻿<Window x:Class="eWallet.GroupWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="Encryption Group" Height="400" MinHeight="400" Width="500" MinWidth="500" ResizeMode="CanResizeWithGrip">
    <Grid>
        <TabControl Name="MainTab" Margin="12,12,12,55">
			
            <TabItem Header="_General" Name="GeneralTabItem">
				<Grid>
					<Grid.RowDefinitions>
						<RowDefinition Height="Auto" />
						<RowDefinition Height="Auto" />
						<RowDefinition />
					</Grid.RowDefinitions>
					<Grid.ColumnDefinitions>
						<ColumnDefinition Width="Auto" />
						<ColumnDefinition />
					</Grid.ColumnDefinitions>

					<TextBlock Style="{StaticResource InfoText}" TextWrapping="Wrap" Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2">
						On this tab you specify the name and description for the new group you are creating.
					</TextBlock>

					<Label Grid.Row="1" Grid.Column="0" ToolTip="Specify the name of the group. The name must be unique and the maximum length of the name is 64 characters.">_Name:</Label>
					<TextBox Name="NameTextbox" Grid.Row="1" Grid.Column="1" MaxLength="64" />

					<Label Grid.Row="2" Grid.Column="0" ToolTip="Specify the description of the group. The description can be as long as you like.">_Description:</Label>
					<TextBox Name="DescriptionTextbox" Grid.Row="2" Grid.Column="1" AcceptsReturn="True" TextWrapping="Wrap" VerticalScrollBarVisibility="Visible" />
				</Grid>
			</TabItem>
            
			<TabItem Header="_Encryption" Name="EncryptionTabItem">
				<Grid>
					<Grid.RowDefinitions>
						<RowDefinition Height="Auto" />
						<RowDefinition Height="Auto" />
						<RowDefinition Height="Auto" />
						<RowDefinition Height="Auto" />
					</Grid.RowDefinitions>
					<Grid.ColumnDefinitions>
						<ColumnDefinition Width="Auto" />
						<ColumnDefinition />
					</Grid.ColumnDefinitions>

					<TextBlock Style="{StaticResource InfoText}" Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2" TextWrapping="Wrap">On this tab you select how you want to protect the secrets that are members of this group.</TextBlock>

					<Label Grid.Row="1" Grid.Column="0">Encryption Method:</Label>
					<ComboBox Grid.Row="1" Grid.Column="1" Name="EncryptionMethodCombo" SelectionChanged="EncryptionMethodCombo_SelectionChanged">
						<ComboBoxItem Tag="Password" ToolTip="Select this option to protect the secrets using a password.">Password</ComboBoxItem>
						<ComboBoxItem Tag="Certificate" ToolTip="Select this option to protect the secrets using a certificate. To add to security, that certificate could be stored on a smart card so that you would need to physically insert the card in order to get to the secrets protected by the group.">Certificate</ComboBoxItem>
					</ComboBox>

					<GroupBox Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="2" Name="PasswordEncryptionGroup" Header="Password Encryption Settings" Margin="0,10,0,0" Visibility="Collapsed">
						<StackPanel>
							<TextBlock Style="{StaticResource InfoText}" TextWrapping="Wrap">Enter the password you want to use for protecting the secrets in this group.</TextBlock>

							<Grid>
								<Grid.RowDefinitions>
									<RowDefinition Height="Auto" />
									<RowDefinition Height="Auto" />
									<RowDefinition Height="Auto" />
								</Grid.RowDefinitions>
								<Grid.ColumnDefinitions>
									<ColumnDefinition Width="Auto" />
									<ColumnDefinition />
								</Grid.ColumnDefinitions>

								<Label Grid.Row="0" Grid.Column="0">_Password:</Label>
								<PasswordBox Name="PasswordTextbox" Grid.Row="0" Grid.Column="1"></PasswordBox>

								<Label Grid.Row="1" Grid.Column="0">_Retype Password:</Label>
								<PasswordBox Name="RetypePasswordTextbox" Grid.Row="1" Grid.Column="1"></PasswordBox>

								<Button Name="GeneratePasswordButton" Grid.Row="2" Grid.Column="1" Click="GeneratePasswordButton_Click" HorizontalAlignment="Left" ToolTip="Use this button to open a tool that you can use to generate a password for you, if you don't want to make up a password for your self.">Generate Password</Button>
							</Grid>
						</StackPanel>
					</GroupBox>

					<GroupBox Grid.Row="3" Grid.Column="0" Grid.ColumnSpan="2" Name="CertificateEncryptionGroup" Header="Certificate Encryption Settings" Margin="0,10,0,0" Visibility="Collapsed">
						<StackPanel>
							<TextBlock Style="{StaticResource InfoText}" TextWrapping="Wrap">
                                    Select the certificate you want to use for protecting secrets in this group. Please note that in order for
                                    you to be able to read the secrets you must have access to the private key as well. e-Wallet will allow you
                                    to protect secrets with a certificate that you don't have access to the private key to, but will warn you if
                                    you do so.
							</TextBlock>

							<Grid>
								<Grid.RowDefinitions>
									<RowDefinition Height="Auto" />
									<RowDefinition Height="Auto" />
								</Grid.RowDefinitions>
								<Grid.ColumnDefinitions>
									<ColumnDefinition Width="Auto" />
									<ColumnDefinition Width="*" />
									<ColumnDefinition Width="Auto" />
								</Grid.ColumnDefinitions>

								<Label Grid.Row="0" Grid.Column="0">Certificate:</Label>
								<TextBox Name="CertificateTextbox" Grid.Row="0" Grid.Column="1" IsEnabled="False"></TextBox>
								<Button Name="BrowseCertificateButton" Grid.Row="0" Grid.Column="2" Height="23" Width="23" ToolTip="Click this button to browse for a certificate." Click="BrowseCertificateButton_Click">...</Button>

								<Button Name="ViewCertificateButton" Grid.Row="1" Grid.Column="1" HorizontalAlignment="Left" IsEnabled="False" ToolTip="Click this button to view the selected certificate.">View</Button>
							</Grid>
						</StackPanel>
					</GroupBox>

				</Grid>
			</TabItem>
			
        </TabControl>
        
        <Button Name="OKButton" Style="{StaticResource DialogButton}" VerticalAlignment="Bottom" HorizontalAlignment="Right" Margin="0,0,73,13.04" Click="OKButton_Click" IsDefault="True">_OK</Button>
        <Button Name="CancelButton" Style="{StaticResource DialogButton}" HorizontalAlignment="Right" Margin="0,0,12,13" VerticalAlignment="Bottom" Click="CancelButton_Click" IsCancel="True">_Cancel</Button>
    </Grid>
</Window>
